package com.laiyizhan.cms.first.controller;

import com.laiyizhan.cms.first.request.ThirdAndFourthRequest;
import com.laiyizhan.cms.first.service.IThirdAndFourthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * Created by SoulWolf on 2017/7/20.
 */
@Controller
@RequestMapping("/admin")
public class ThirdAndFourthController {

    @Autowired
    IThirdAndFourthService thirdAndFourth;

    /*目录页面*/
    @RequestMapping(value = "/third/index/show")
    public String third_index(ThirdAndFourthRequest request,HttpSession httpSession,ModelMap modelMap) {
        request.setoName((String)httpSession.getAttribute("oName"));
        modelMap.put("state",thirdAndFourth.ThirdAndFourth_index(request));
        httpSession.setAttribute("number", 1);
        return "/third/index";
    }


    @RequestMapping(value = "/third/a/show")
    public String third_a() {
        return "/third/main";
    }
    @RequestMapping(value = "/third/a")
    public String Third_a_record(ModelMap map, ThirdAndFourthRequest request, HttpSession httpSession) {
        request.setoName((String)httpSession.getAttribute("oName"));
        thirdAndFourth.Third_a(request);
        map.put("state",thirdAndFourth.ThirdAndFourth_index(request));
        return "/third/index";
    }

    @RequestMapping(value = "/third/b/show")
    public String third_b() {
        return "/third/b";
    }
    @RequestMapping(value = "/third/b")
    public String Third_b_record(ModelMap map, ThirdAndFourthRequest request,HttpSession httpSession) {
        request.setoName((String)httpSession.getAttribute("oName"));
        thirdAndFourth.Third_b(request);
        map.put("state",thirdAndFourth.ThirdAndFourth_index(request));
        return "/third/index";
    }

    /*目录页面*/
    @RequestMapping(value = "/fourth/index/show")
    public String fourth_index(ThirdAndFourthRequest request,HttpSession httpSession,ModelMap modelMap) {
        request.setoName((String)httpSession.getAttribute("oName"));
        modelMap.put("state",thirdAndFourth.ThirdAndFourth_index(request));
        httpSession.setAttribute("number", 1);
        return "/fourth/index";
    }



    @RequestMapping(value = "/fourth/a/show")
    public String fourth_a() {
        return "/fourth/a";
    }
    @RequestMapping(value = "/fourth/a")
    public String Fourth_a_record(ModelMap map, ThirdAndFourthRequest request,HttpSession httpSession) {
        request.setoName((String)httpSession.getAttribute("oName"));
        thirdAndFourth.Fourth_a(request);
        map.put("state",thirdAndFourth.ThirdAndFourth_index(request));
        return "/fourth/index";
    }

    @RequestMapping(value = "/fourth/b/show")
    public String fourth_b() {
        return "/fourth/b";
    }
    @RequestMapping(value = "/fourth/b")
    public String Fourth_b_record(ModelMap map, ThirdAndFourthRequest request,HttpSession httpSession) {
        request.setoName((String)httpSession.getAttribute("oName"));
        thirdAndFourth.Fourth_b(request);
        map.put("state",thirdAndFourth.ThirdAndFourth_index(request));
        return "/fourth/index";
    }



}
